//
//  LGHomeItemView.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/2/24.
//

#import "LGHomeItemView.h"

#define itemWidth  (Screen_W-viewPix(32))/4.0

#define itemHeight  viewPix(70)

@interface LGHomeItemView()
/**   */
@property (nonatomic , strong)UIButton *signBtn;
/**   */
@property (nonatomic , strong)UILabel *signTitle;
/**   */
@property (nonatomic , strong)UIButton *planBtn;
/**   */
@property (nonatomic , strong)UILabel *planTitle;
/**   */
@property (nonatomic , strong)UIButton *riskBtn;
/**   */
@property (nonatomic , strong)UILabel *riskTitle;
/**   */
@property (nonatomic , strong)UIButton *recordBtn;
/**   */
@property (nonatomic , strong)UILabel *recordTitle;

@end

@implementation LGHomeItemView

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}

-(void)itemButtonTouched:(UIButton *)sender{
    
}

#pragma mark
#pragma mark ====> 创建控件
-(void)createSubView{
    self.backgroundColor = [UIColor whiteColor];
    [self addSubview:self.signBtn];
    [self.signBtn addSubview:self.signTitle];
    [self addSubview:self.planBtn];
    [self.planBtn addSubview:self.planTitle];
    [self addSubview:self.riskBtn];
    [self.riskBtn addSubview:self.riskTitle];
    [self addSubview:self.recordBtn];
    [self.recordBtn addSubview:self.recordTitle];
}

-(UIButton *)signBtn{
    if(!_signBtn){
        _signBtn = [UIButton buttonWithTitle:@"0" titleFont:LGFontWeight(18, UIFontWeightSemibold) textColor:@"#2E9AFC" imageName:@""];
        _signBtn.frame = CGRectMake(0, 0, itemWidth, itemHeight);
        [_signBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, viewPix(26), 0)];
        [_signBtn addTarget:self action:@selector(itemButtonTouched:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _signBtn;
}

-(UIButton *)planBtn{
    if(!_planBtn){
        _planBtn = [UIButton buttonWithTitle:@"0" titleFont:LGFontWeight(18, UIFontWeightSemibold) textColor:@"#2E9AFC" imageName:@""];
        _planBtn.frame = CGRectMake(itemWidth, 0, itemWidth, itemHeight);
        [_planBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, viewPix(26), 0)];
        [_planBtn addTarget:self action:@selector(itemButtonTouched:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _planBtn;
}

-(UIButton *)riskBtn{
    if(!_riskBtn){
        _riskBtn = [UIButton buttonWithTitle:@"0" titleFont:LGFontWeight(18, UIFontWeightSemibold) textColor:@"#2E9AFC" imageName:@""];
        _riskBtn.frame = CGRectMake(itemWidth*2, 0, itemWidth, itemHeight);
        [_riskBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, viewPix(26), 0)];
        [_riskBtn addTarget:self action:@selector(itemButtonTouched:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _riskBtn;
}

-(UIButton *)recordBtn{
    if(!_recordBtn){
        _recordBtn = [UIButton buttonWithTitle:@"0" titleFont:LGFontWeight(18, UIFontWeightSemibold) textColor:@"#2E9AFC" imageName:@""];
        _recordBtn.frame = CGRectMake(itemWidth*3, 0, itemWidth, itemHeight);
        [_recordBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, 0, viewPix(26), 0)];
        [_recordBtn addTarget:self action:@selector(itemButtonTouched:) forControlEvents:UIControlEventTouchUpInside];
    }
    return _recordBtn;
}

-(UILabel *)signTitle{
    if(!_signTitle){
        _signTitle = [UILabel lableWithText:@"签约审核" colorString:@"#2E6AAE" textFont:LGFontWeight(14, UIFontWeightMedium) textAlignment:NSTextAlignmentCenter lines:1];
        _signTitle.frame = CGRectMake(0, viewPix(37), itemWidth, viewPix(20));
    }
    return _signTitle;
}

-(UILabel *)planTitle{
    if(!_planTitle){
        _planTitle = [UILabel lableWithText:@"方案审核" colorString:@"#2E6AAE" textFont:LGFontWeight(14, UIFontWeightMedium) textAlignment:NSTextAlignmentCenter lines:1];
        _planTitle.frame = CGRectMake(0, viewPix(37), itemWidth, viewPix(20));
    }
    return _planTitle;
}

-(UILabel *)riskTitle{
    if(!_riskTitle){
        _riskTitle = [UILabel lableWithText:@"风险预警" colorString:@"#2E6AAE" textFont:LGFontWeight(14, UIFontWeightMedium) textAlignment:NSTextAlignmentCenter lines:1];
        _riskTitle.frame = CGRectMake(0, viewPix(37), itemWidth, viewPix(20));
    }
    return _riskTitle;
}

-(UILabel *)recordTitle{
    if(!_recordTitle){
        _recordTitle = [UILabel lableWithText:@"入院安排" colorString:@"#2E6AAE" textFont:LGFontWeight(14, UIFontWeightMedium) textAlignment:NSTextAlignmentCenter lines:1];
        _recordTitle.frame = CGRectMake(0, viewPix(37), itemWidth, viewPix(20));
    }
    return _recordTitle;
}

@end
